$(function(){
    $("#form").click(function(){
        var order_amt=$("#order_amt").val();
        var order_pay_type=$("#order_pay_type").val();
        var iss_ins_cd=$("#iss_ins_cd").val();
        var userCode=$("#userCode").val();
        var customer_code=$("#customer_code").val();
        var secretkey=$("#secretkey").val();
        var pageNotify=$("#pageNotify").val();
        var backNotify=$("#backNotify").val();
        if(!/^\d+(\.\d{1,2})?$/.test(order_amt)){
            alert("金额格式错误");
            return;
        }
        $.post("/fuyou/smpGateApp","&order_amt="+order_amt+"&pageNotify="+pageNotify+"&backNotify="+backNotify+"&order_pay_type="+order_pay_type+"&iss_ins_cd="+iss_ins_cd+"&userCode="+userCode+"&customer_code="+customer_code+"&secretkey="+secretkey,
            function(data){
                var resultDate = JSON.parse(data.data);
                $("#mchnt_cd").val(resultDate.mchnt_cd);
                $("#order_id").val(resultDate.order_id);
                $("#order_amt").val(resultDate.order_amt);
                $("#order_pay_type").val(resultDate.order_pay_type);
                $("#page_notify_url").val(resultDate.page_notify_url);
                $("#back_notify_url").val(resultDate.back_notify_url);
                $("#order_valid_time").val(resultDate.order_valid_time);
                $("#iss_ins_cd").val(resultDate.iss_ins_cd);
                $("#goods_name").val(resultDate.goods_name);
                $("#goods_display_url").val(resultDate.goods_display_url);
                $("#rem").val(resultDate.rem);
                $("#ver").val(resultDate.ver);
                $("#md5").val(resultDate.md5);
                sub();
            },"json"
        )
    })

    function sub(){
        $("#form1").submit();
    }
})